#include<iostream>
#include<cstring>
#include<iomanip>

using namespace std;
int a[26][26];

int main() {
    int x, y, n;
    cin >> n;
    memset(a, 0, sizeof(a));
    int num = n * n;
    x = n;
    y = n;
    a[x][y] = n * n;
    while (num > 1) {
        while (x - 1 >= 1 && !a[x - 1][y]) a[--x][y] = --num;//向上填数 
        while (y - 1 >= 1 && !a[x][y - 1]) a[x][--y] = --num;//向左填数 
        while (x + 1 <= n && !a[x + 1][y]) a[++x][y] = --num;//向下填数 
        while (y + 1 <= n && !a[x][y + 1]) a[x][++y] = --num;//向右填数 
    }
    for (x = 1; x <= n; x++) {
        for (y = 1; y <= n; y++)
            cout << setw(4) << a[x][y];
        cout << endl;
    }
    return 0;
} 
/*
  10  11  12  13
   9   2   3  14
   8   1   4  15
   7   6   5  16
-----------------
16  5  6  7
15  4  1  8
14  3  2  9
13 12 11 10
*/
